<!DOCTYPE html>
<html lang="en">
<!-- Beautiful Jekyll | MIT license | Copyright Dean Attali 2016 -->
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="msvalidate.01" content="CB7D41B769EED78B294F9EB873406AA8"/>

    <title>Appium support</title>
    <meta name="Description" content="FluentLenium is a website automation framework which
   extends Selenium to write reliable and resilient UI functional tests.
    This framework is React ready. Written and maintained by people who
     are automating browser-based tests on a daily basis.">
    <meta name="author" content="FluentLenium"/>


    <meta name="description" content="FluentLenium">


    <link rel="alternate" type="application/rss+xml"
          title="FluentLenium - FluentLenium is a website automation framework which extends Selenium to write reliable and resilient UI functional tests."
          href="/feed.xml"/>


    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css"/>


    <link rel="stylesheet" href="/css/bootstrap.min.css"/>

    <link rel="stylesheet" href="/css/bootstrap-social.css"/>

    <link rel="stylesheet" href="/css/main.css"/>


    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic"/>

    <link rel="stylesheet"
          href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800"/>


    <!-- Facebook OpenGraph tags -->
    <meta property="og:title" content="Appium support"/>
    <meta property="og:type" content="website"/>

    <meta property="og:url" content="http://fluentlenium.io/docs/appium-support/"/>


    <meta property="og:image" content="http://fluentlenium.io/img/avatar-icon.png"/>


    <!-- Twitter summary cards -->
    <meta name="twitter:card" content="summary"/>
    <meta name="twitter:site" content="@FluentLenium"/>
    <meta name="twitter:creator" content="@FluentLenium"/>
    <meta name="twitter:title" content="Appium support"/>
    <meta name="twitter:description"
          content="## Appium support - [Overview](#overview) - [Web support](#web-support) - [Native support](#native-support) ## Overview FluentLenium syntax can be used for mobile automation together with Appium. Just add additional dependency into your pom.xml. ```xml io.appium java-client LATEST ``` Environment setup is not related to FluentLenium but we recommend the following tutorials: -..."/>

    <meta name="twitter:image" content="http://fluentlenium.io/img/avatar-icon.png"/>


    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-132760260-1"></script>
    <script>
        window.dataLayer = window.dataLayer || [];

        function gtag() {
            dataLayer.push(arguments);
        }

        gtag('js', new Date());

        gtag('config', 'UA-132760260-1');
    </script>
</head>


<body>

<nav class="navbar navbar-default navbar-fixed-top navbar-custom">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="http://fluentlenium.io">FluentLenium</a>
        </div>

        <div class="collapse navbar-collapse" id="main-navbar">
            <ul class="nav navbar-nav navbar-right">


                <li>


                    <a href="/">Home</a>

                </li>


                <li>


                    <a href="/quickstart">Quickstart</a>

                </li>


                <li class="navlinks-container">
                    <a class="navlinks-parent" href="javascript:void(0)">Docs</a>
                    <div class="navlinks-children">


                        <a href="/docs/test-runners">Supported Test runners</a>


                        <a href="/docs/locators">Finding elements</a>


                        <a href="/docs/key_features">Key features</a>


                        <a href="/docs/configuration">Configuration</a>


                        <a href="/docs/test-methods">Test methods</a>


                        <a href="/docs/assertion-libraries">Assertion libraries</a>


                        <a href="/docs/appium-support">Appium support</a>


                        <a href="https://fluentlenium.io/javadoc">Javadoc</a>


                    </div>
                </li>


                <li class="navlinks-container">
                    <a class="navlinks-parent" href="javascript:void(0)">Migration</a>
                    <div class="navlinks-children">


                        <a href="/migration/from-0.13.2-to-1.0-or-3.0">to 3.0</a>


                        <a href="/migration/3.0-to-4.0">from 3.0 to 4.0</a>


                    </div>
                </li>


                <li>


                    <a href="/about">About</a>

                </li>


                <li class="navlinks-container">
                    <a class="navlinks-parent" href="javascript:void(0)">Github</a>
                    <div class="navlinks-children">


                        <a href="https://github.com/FluentLenium/FluentLenium">Sources</a>


                        <a href="https://github.com/FluentLenium/FluentLenium/issues">Issues</a>


                        <a href="https://github.com/FluentLenium/FluentLenium/releases">Releases</a>


                    </div>
                </li>


            </ul>
        </div>


        <div class="avatar-container">
            <div class="avatar-img-border">
                <a href="http://fluentlenium.io ">
                    <img class="avatar-img" src="/img/avatar-icon.png"/>
                </a>
            </div>
        </div>


    </div>
</nav>

<nav class="sidebar">

    <ul>

        <li><a href="#overview">Overview</a></li>

        <li><a href="#web-support">Web support</a></li>

        <li><a href="#native-support">Native support</a></li>

    </ul>

</nav>


<!-- TODO this file has become a mess, refactor it -->


<header class="header-section ">

    <div class="intro-header no-img">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                    <div class="page-heading">
                        <h1>Appium support</h1>


                        <hr class="small">
                        <span class="page-subheading">FluentLenium</span>


                    </div>
                </div>
            </div>
        </div>
    </div>
</header>


<div class="container" role="main">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            <h2 id="appium-support">Appium support</h2>
            <ul>
                <li><a href="#overview">Overview</a></li>
                <li><a href="#web-support">Web support</a></li>
                <li><a href="#native-support">Native support</a></li>
            </ul>

            <h2 id="overview">Overview</h2>

            <p>FluentLenium syntax can be used for mobile automation together with Appium.
                Just add additional dependency into your pom.xml.</p>

            <div class="language-xml highlighter-rouge">
                <div class="highlight"><pre class="highlight"><code> <span class="nt">&lt;dependency&gt;</span>
       <span class="nt">&lt;groupId&gt;</span>io.appium<span class="nt">&lt;/groupId&gt;</span>
       <span class="nt">&lt;artifactId&gt;</span>java-client<span class="nt">&lt;/artifactId&gt;</span>
       <span class="nt">&lt;version&gt;</span>LATEST<span class="nt">&lt;/version&gt;</span>
 <span class="nt">&lt;/dependency&gt;</span>
</code></pre>
                </div>
            </div>

            <p>Environment setup is not related to FluentLenium but we recommend the following tutorials:</p>

            <ul>
                <li><a href="https://www.swtestacademy.com/appium-tutorial/">Appium Install</a></li>
                <li>
                    <a href="https://medium.com/2359media/tutorial-automated-testing-on-ios-with-appium-test-ng-and-java-on-mac-bc115d0ec881">iOS
                        Guide</a></li>
                <li>
                    <a href="https://medium.com/2359media/tutorial-automated-testing-on-android-and-ios-with-appium-testng-and-java-on-mac-210119edf323">Android
                        Guide</a></li>
            </ul>

            <p>And sample apps:</p>

            <ul>
                <li><a href="https://github.com/King-of-Spades/AppCenter-Samples/tree/master/Appium/iOS">iOS</a></li>
                <li><a href="https://github.com/King-of-Spades/AppCenter-Samples/tree/master/Appium/Android">Android</a>
                </li>
            </ul>

            <h2 id="web-support">Web support</h2>

            <p>If your only goal is to run web tests using Google Chrome (Android) or Safari (iOS) you don’t even have
                to modify your tests.</p>

            <p>For remote execution just connect devices to Selenium Grid.</p>

            <p>For local execution run Appium server and provide path to chromedriver (it’s needed for Android
                tests).</p>

            <p><code class="language-plaintext highlighter-rouge">appium --address 127.0.0.1 --port 4723
                --chromedriver-executable /home/fluentlenium/drivers/chromedriver</code></p>

            <p>You need to provide correct Capabilities. iPhone simulator example:</p>

            <div class="language-java highlighter-rouge">
                <div class="highlight"><pre class="highlight"><code><span class="nd">@Override</span>
    <span class="kd">public</span> <span class="nc">Capabilities</span> <span class="nf">getCapabilities</span><span
                            class="o">()</span> <span class="o">{</span>
        <span class="nc">DesiredCapabilities</span> <span class="n">capabilities</span> <span class="o">=</span> <span
                            class="k">new</span> <span class="nc">DesiredCapabilities</span><span class="o">();</span>
        <span class="n">capabilities</span><span class="o">.</span><span class="na">setCapability</span><span class="o">(</span><span
                            class="nc">MobileCapabilityType</span><span class="o">.</span><span
                            class="na">PLATFORM_NAME</span><span class="o">,</span> <span class="s">"iOS"</span><span
                            class="o">);</span>
        <span class="n">capabilities</span><span class="o">.</span><span class="na">setCapability</span><span class="o">(</span><span
                            class="nc">MobileCapabilityType</span><span class="o">.</span><span class="na">PLATFORM_VERSION</span><span
                            class="o">,</span> <span class="s">"12.0"</span><span class="o">);</span>
        <span class="n">capabilities</span><span class="o">.</span><span class="na">setCapability</span><span class="o">(</span><span
                            class="nc">MobileCapabilityType</span><span class="o">.</span><span
                            class="na">BROWSER_NAME</span><span class="o">,</span> <span class="s">"Safari"</span><span
                            class="o">);</span>
        <span class="n">capabilities</span><span class="o">.</span><span class="na">setCapability</span><span class="o">(</span><span
                            class="nc">MobileCapabilityType</span><span class="o">.</span><span
                            class="na">DEVICE_NAME</span><span class="o">,</span> <span class="s">"iPhone 8"</span><span
                            class="o">);</span>
        <span class="k">return</span> <span class="n">capabilities</span><span class="o">;</span>
    <span class="o">}</span>
</code></pre>
                </div>
            </div>

            <p>Examples can be found <a
                    href="https://github.com/FluentLenium/FluentLenium/tree/develop/examples/spring">here</a></p>

            <h2 id="native-support">Native support</h2>

            <p>FluentLenium fully supports native iOS, Android, Mac and Windows automation
                including the most popular drivers (XCUITest, Espresso, UIAutomator2, Windows).</p>

            <p>You can provide custom MobileBy selectors and FluentLenium would inject them in the same way as web
                selectors. Examples:</p>

            <div class="language-java highlighter-rouge">
                <div class="highlight"><pre class="highlight"><code>    <span class="nd">@iOSXCUITFindBy</span><span
                        class="o">(</span><span class="n">accessibility</span> <span class="o">=</span> <span class="s">"iosAccessibilityId"</span><span
                        class="o">)</span>
    <span class="kd">private</span> <span class="nc">FluentWebElement</span> <span
                            class="n">iosAccessibilityId</span><span class="o">;</span>

    <span class="nd">@AndroidFindBy</span><span class="o">(</span><span class="n">uiAutomator</span> <span
                            class="o">=</span> <span class="s">"androidUiAutomator"</span><span class="o">)</span>
    <span class="kd">private</span> <span class="nc">FluentWebElement</span> <span
                            class="n">androidUiAutomator</span><span class="o">;</span>

    <span class="nd">@WindowsFindBy</span><span class="o">(</span><span class="n">windowsAutomation</span> <span
                            class="o">=</span> <span class="s">"windows"</span><span class="o">)</span>
    <span class="kd">private</span> <span class="nc">FluentWebElement</span> <span
                            class="n">windowsAutomation</span><span class="o">;</span>
</code></pre>
                </div>
            </div>

            <p>This element would be identified by tag in iOS profile and be accessibilityId in Android profile.</p>

            <div class="language-java highlighter-rouge">
                <div class="highlight"><pre class="highlight"><code>    <span class="nd">@AndroidFindBy</span><span
                        class="o">(</span><span class="n">accessibility</span> <span class="o">=</span> <span class="s">"android"</span><span
                        class="o">)</span>
    <span class="nd">@iOSXCUITFindBy</span><span class="o">(</span><span class="n">tagName</span> <span
                            class="o">=</span> <span class="s">"ios"</span><span class="o">)</span>
    <span class="kd">private</span> <span class="nc">FluentWebElement</span> <span class="n">multiPlatformElement</span><span
                            class="o">;</span>
</code></pre>
                </div>
            </div>

            <p>You can also find elements without injection (just like in Web FluentLenium):</p>

            <div class="language-java highlighter-rouge">
                <div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="nc">SwiftNoteHomePage</span> <span
                        class="nf">search</span><span class="o">(</span><span class="nc">String</span> <span class="n">searchPhrase</span><span
                        class="o">)</span> <span class="o">{</span>
        <span class="n">el</span><span class="o">(</span><span class="nc">MobileBy</span><span class="o">.</span><span
                            class="na">AccessibilityId</span><span class="o">(</span><span
                            class="s">"Search"</span><span class="o">)).</span><span class="na">click</span><span
                            class="o">();</span>
        <span class="nc">FluentWebElement</span> <span class="n">searchInput</span> <span class="o">=</span> <span
                            class="n">el</span><span class="o">(</span><span class="nc">MobileBy</span><span
                            class="o">.</span><span class="na">id</span><span class="o">(</span><span class="s">"com.moonpi.swiftnotes:id/search_src_text"</span><span
                            class="o">));</span>
        <span class="n">await</span><span class="o">().</span><span class="na">until</span><span class="o">(</span><span
                            class="n">searchInput</span><span class="o">).</span><span class="na">displayed</span><span
                            class="o">();</span>
        <span class="n">searchInput</span><span class="o">.</span><span class="na">fill</span><span class="o">().</span><span
                            class="na">with</span><span class="o">(</span><span class="n">searchPhrase</span><span
                            class="o">);</span>
        <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
    <span class="o">}</span>
</code></pre>
                </div>
            </div>

            <p>Please have in mind that mobile automation work well only if correct Capabilities are configured.
                We throw the following exception if something is missing:</p>

            <div class="language-java highlighter-rouge">
                <div class="highlight"><pre class="highlight"><code><span class="kd">private</span> <span class="kt">void</span> <span
                        class="nf">checkCapabilities</span><span class="o">(</span><span class="nc">String</span> <span
                        class="n">platform</span><span class="o">,</span> <span class="nc">String</span> <span
                        class="n">automation</span><span class="o">)</span> <span class="o">{</span>
        <span class="kt">boolean</span> <span class="n">correctConfiguration</span> <span class="o">=</span> <span
                            class="n">isAndroid</span><span class="o">(</span><span class="n">platform</span><span
                            class="o">)</span> <span class="o">||</span> <span class="n">isIos</span><span
                            class="o">(</span><span class="n">platform</span><span class="o">,</span> <span class="n">automation</span><span
                            class="o">)</span> <span class="o">||</span> <span class="n">isWindows</span><span
                            class="o">(</span><span class="n">platform</span><span class="o">);</span>
        <span class="k">if</span> <span class="o">(!</span><span class="n">correctConfiguration</span><span
                            class="o">)</span> <span class="o">{</span>
            <span class="k">throw</span> <span class="k">new</span> <span class="nf">ConfigurationException</span><span
                            class="o">(</span><span class="s">"You have annotated elements with Appium @FindBys"</span> <span
                            class="o">+</span>
                    <span class="s">" but capabilities are incomplete. Please use one of these configurations:\n"</span> <span
                            class="o">+</span>
                    <span class="s">"platformName:Windows\n"</span> <span class="o">+</span>
                    <span class="s">"plaformName:Android\n"</span> <span class="o">+</span>
                    <span class="s">"plaformName:iOS, automationName:XCUITest"</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">}</span>
</code></pre>
                </div>
            </div>

            <p>Examples can be found <a
                    href="https://github.com/FluentLenium/FluentLenium/tree/develop/examples/appium">here</a></p>


        </div>
    </div>
</div>


<footer>
    <div class="container beautiful-jekyll-footer">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center footer-links">


                    <li>
                        <a href="https://github.com/FluentLenium" title="GitHub">
              <span class="fa-stack fa-lg">
                <i class="fa fa-circle fa-stack-2x"></i>
                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
              </span>
                        </a>
                    </li>


                    <li>
                        <a href="https://twitter.com/FluentLenium" title="Twitter">
              <span class="fa-stack fa-lg">
                <i class="fa fa-circle fa-stack-2x"></i>
                <i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
              </span>
                        </a>
                    </li>


                </ul>
                <p class="copyright text-muted">
                    FluentLenium
                    &nbsp;&bull;&nbsp;
                    2021


                    &nbsp;&bull;&nbsp;
                    <a href="http://fluentlenium.io">fluentlenium.io</a>

                </p>
                <!-- Please don't remove this, keep my open source work credited :) -->
                <p class="theme-by text-muted">
                    Theme by
                    <a href="http://deanattali.com/beautiful-jekyll/">beautiful-jekyll</a>
                </p>
            </div>
        </div>
    </div>
</footer>


<!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->

<script>
    if (typeof jQuery == 'undefined') {
        document.write('<script src="/js/jquery-1.11.2.min.js"></scr' + 'ipt>');
    }
</script>


<!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->

<script src="/js/bootstrap.min.js"></script>


<!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->

<script src="/js/main.js"></script>


</body>
</html>
